package main

func main() {
	println(containsDuplicate([]int{1, 2, 3, 1}))
}

func containsDuplicate(nums []int) bool {

	var m = make(map[int]int, len(nums))
	for i, n := range nums {
		if _, ok := m[n]; ok {
			return true
		}

		m[n] = i
	}
	return false
}
